<?php 
	include($_SERVER['DOCUMENT_ROOT']."/headerins.php");
?>

<?php

$q=$_GET["q"];

$sql="SELECT id, code, name FROM material WHERE code like '%".$q."%'";

$result = mysql_query($sql);

/*echo "<table border='1'>
<tr>
<th>ID</th>
<th>code</th>
<th>name</th>
</tr>";
*/
while($row = mysql_fetch_array($result)){
  //echo "<tr>";
  echo "<option value='".$row['id']."'>" . $row['code'] ."</option>";
/*  echo "<td>" . $row['code'] . "</td>";
  echo "<td>" . $row['name'] . "</td>";
  echo "</tr>";*/
}
//echo "</table>";

?> 
